import axios from 'axios'
import {
  closeLoading,
  closeLoadingByException,
  openLoading
} from '@/utils/interceptor/loading'
import { reqToken } from '@/utils/interceptor/token'

const req = axios.create({
  baseURL: '/api',
  timeout: 5000
})
req.interceptors.request.use(openLoading)
req.interceptors.response.use(closeLoading, closeLoadingByException)
req.interceptors.request.use(reqToken)
export default req
